/* ----------------------------------------------------------------------
*
* Copyright (C) 2025 XiaoFei. All rights reserved.
*
* $file:		XiaoZhi_LightResis.h
* $Date:        26-January-2025
* $Revision: 	V1
* $Project: 	XiaoFei BSP Library
* $Taobao:      https://item.taobao.com/item.htm?abbucket=17&id=789798906271
*
* -------------------------------------------------------------------- */

#ifndef __XiaoZhi_LightResis_H
#define __XiaoZhi_LightResis_H

#define LightResis_Use_DO

#if defined(LightResis_Use_ADC2)||defined(LightResis_Use_ADC1)
    #define LightResis_RCC_AO			RCC_APB2Periph_GPIOA
    #define LightResis_GPIO_AO			GPIOA
    #define LightResis_PIN_AO			GPIO_Pin_1
    #define LightResis_ADC_Channel		ADC_Channel_1
#endif

#ifdef LightResis_Use_DO
    #define LightResis_RCC_DO			RCC_APB2Periph_GPIOA
    #define LightResis_GPIO_DO			GPIOA
    #define LightResis_PIN_DO			GPIO_Pin_1
    #define LightResis_Trigger			Bit_RESET
#endif

/* 
* @function: 	LightResis_Init
*/
void LightResis_Init(void);

#if defined(LightResis_Use_ADC2)||defined(LightResis_Use_ADC1)
/* 
* @function: 	LightResis_GetValue
* @return:		The ADC value from light resistance. This value will be mapped from 0 to 3.3 volts to 0 to 4096.
*/
unsigned int LightResis_GetValue(void);
#endif

#if defined(LightResis_Use_ADC2)||defined(LightResis_Use_ADC1)
/* 
* @function: 	LightResis_GetVoltage
* @return:		The Voltage value from light resistance. This value need to be limited to 0 to 3.3 volts.
*/
float LightResis_GetVoltage(void);
#endif

#ifdef LightResis_Use_DO
/* 
* @function: 	LightResis_IsTrigger
* @return:		Return 0x01 if the light resistance is trigger.
*/
unsigned char LightResis_IsTrigger(void);
#endif
	
#endif


